package jdbc;

import java.sql.*;

public class jdbcclassset {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
        String name = "root";
        String password = "asd123asd123";
        Connection connection = DriverManager.getConnection(url, name, password);
        String sql="SELECT `id`,`username`,`password` FROM `user`";
        Statement statement = connection.createStatement();
        ResultSet set = statement.executeQuery(sql);
        while (set.next()){
            String s = set.getString(2);//2是第二例
            long id = set.getLong(1);
            System.out.println("id is "+id +"username is "+s);
        }


    }

}
